import Dexie from 'dexie';

class MyDB extends Dexie {
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  AppStore: Dexie.Table<any, string>; // number = type of the primary key

  private  constructor() {

    super('MyDB');
    this.version(1).stores({
      AppStoreTable: 'key',
    });

    this.AppStore = this.table('AppStoreTable');
  }
  // 是否实例的标志
    private static instance: MyDB | null = null
  // 单例模式
  static getInstance() {
    if (MyDB.instance === null) {
      MyDB.instance = new MyDB()
    }
    return MyDB.instance
}

}

export default MyDB.getInstance();